#Copyright 2003, Cypress Semiconductor Corporation

#*****************************************************************************#

#This software is owned by Cypress Semiconductor Corporation (Cypress) and is

#protected by United States copyright laws and international treaty provisions.

#Cypress hereby grants to Licensee a personal, non-exclusive, non-transferable 

#license to copy, use, modify, create derivative works of, and compile the 

#Cypress Source Code and derivative works for the sole purpose of creating 

#custom software in support of Licensee product ("Licensee Product") to be 

#used only in conjunction with a Cypress integrated circuit. Any reproduction, 

#modification, translation, compilation, or representation of this software 

#except as specified above is prohibited without the express written permission

#of Cypress.





#Disclaimer: Cypress makes no warranty of any kind, express or implied, with 

#regard to this material, including, but not limited to, the implied warranties

#of merchantability and fitness for a particular purpose. Cypress reserves the 

#right to make changes without further notice to the materials described 

#herein. Cypress does not assume any liability arising out of the application 

#or use of any product or circuit described herein. Cypress products described

# herein are not authorized for use as components in life-support devices.

#This software is protected by and subject to worldwide patent coverage, 

#including U.S. and foreign patents. Use may be limited by and subject to 

#the Cypress Software License Agreement.

#*****************************************************************************#



#Source File Information Header Template

# *******************************************************************

# File : 

# Author :Prokash Ghosh 

# Author s Email:pbg@cypress.com

# Date : 30 AUG,03 

# Revision : 1.1  

# *******************************************************************

# Description : This script is to run the VHDL model simualtion with ModelSim Simulator.

# (Add succinct functionality description here.)

#

# *******************************************************************

#!/bin/tcsh

##############################################################################

# Cypress Semiconductor Confidential. Copyright 2001, All Rights reserved    #

# Permission to use, modify or copy this code is prohibited without the      #

# express written consent of Cypress Semiconductor.                          #

# 110 Nortech Parkway, San Jose, CA 95134                                    #

#                                                                            #

# Author: pbg@cypress.com                                                    #

# $Date: 28/05/03 #                                                          #

# $Revision: 1.0 $ #                                                         #

##############################################################################

set m = `echo $1 | cut -d"." -f1`

set p = `pwd`

set model_dir = $p/../../VHDL/model

set run_dir   = $p/../../VHDL/run

set tb_dir   = $p/../../VHDL/tb

set rpt_dir   = $p/../../VHDL/rpt/



cd $tb_dir

if("$2" != "8") then

echo " Do you want to generate the VCD file(Y/N) : Default is No "

echo " Enter an Option:"

set res1 = $<

##echo SIMULATION STARTED AT `date`  >>$run_dir/cmd

echo " cd $tb_dir" >>$run_dir/cmd

echo "\rm -rf work" >>$run_dir/cmd

\rm -rf work

echo "vlib work " >>$run_dir/cmd

vlib work





      echo "vcom -quiet $model_dir/pack_disp_conv_dis.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/test_tasks_pkg_rx.vhd" >>$run_dir/cmd 

      echo "vcom -quiet $model_dir/test_tasks_pkg_tx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/txerr_ref.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/lfi_ref.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/SingleChannel_rx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/SingleChannel_tx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/SingleChannel.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/latchs.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/cyp15g0403dxb.vhd" >>$run_dir/cmd

      echo "vcom -quiet $tb_dir/clk_gena.vhd" >>$run_dir/cmd

      echo "vcom -quiet $tb_dir/add_tasks.vhd" >>$run_dir/cmd

      vcom -quiet $model_dir/pack_disp_conv_dis.vhd

      vcom -quiet $model_dir/test_tasks_pkg_rx.vhd 

      vcom -quiet $model_dir/test_tasks_pkg_tx.vhd

      vcom -quiet $model_dir/txerr_ref.vhd

      vcom -quiet $model_dir/lfi_ref.vhd

      vcom -quiet $model_dir/SingleChannel_rx.vhd

      vcom -quiet $model_dir/SingleChannel_tx.vhd

      vcom -quiet $model_dir/SingleChannel.vhd

      vcom -quiet $model_dir/latchs.vhd

      vcom -quiet $model_dir/cyp15g0403dxb.vhd

      vcom -quiet $tb_dir/clk_gena.vhd

      vcom -quiet $tb_dir/add_tasks.vhd

 

echo "vcom -quiet $tb_dir/$1" >>$run_dir/cmd

vcom -quiet $1

# Choosing the dumping option

if (("$res1" == "Y") || ("$res1" == "y")) then

echo "vsim -t 1fs -c cyp15g0403dxb_tb_top -do  "\""vcd file $rpt_dir/$m.vcd ; vcd add -r *; run -all; quit"\""  | tee  $rpt_dir/$m.log ;" >>$run_dir/cmd

vsim -t 1fs -c cyp15g0403dxb_tb_top -do "vcd file $m.vcd ; vcd add -r *; run -all; quit" | tee  $m.log ;

mv $m.vcd $rpt_dir/

else

echo "vsim -t 1fs -c cyp15g0403dxb_tb_top -do  "\""run -all; quit"\"" | tee  $rpt_dir/$m.log;" >>$run_dir/cmd

vsim -t 1fs -c cyp15g0403dxb_tb_top -do " run -all; quit" | tee  $m.log;

endif

#echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf $run_dir/run_default

mv $run_dir/cmd $run_dir/run_default

chmod 755 $run_dir/run_default

mv $m.log $rpt_dir/

\rm -rf *.log

cd $rpt_dir

set s1 = `grep -n PASS $m.log | wc -l`

echo "The testcase = $m"

echo " TOTAL PASS= $s1"

set s2 = `grep -n FAIL $m.log | wc -l`

echo " TOTAL FAIL = $s2"

if (($s2 == 0 ) && ($s1 > 0)) then

echo " Test $m is PASSED "

else if (($s2 == 0)  && ($s1 == 0))  then

echo " Test $m is not simulated "

else

echo "Test $m is FAILED"

endif

cd $run_dir

else #respon===8

cd $tb_dir

##echo SIMULATION STARTED AT `date`  >>$run_dir/cmd

echo " cd $tb_dir" >>$run_dir/cmd

echo "\rm -rf work" >>$run_dir/cmd

\rm -rf work

echo "vlib work " >>$run_dir/cmd

vlib work

      echo "vcom -quiet $model_dir/pack_disp_conv_dis.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/test_tasks_pkg_rx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/test_tasks_pkg_tx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/txerr_ref.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/lfi_ref.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/SingleChannel_rx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/SingleChannel_tx.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/SingleChannel.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/latchs.vhd" >>$run_dir/cmd

      echo "vcom -quiet $model_dir/cyp15g0403dxb.vhd" >>$run_dir/cmd

      echo "vcom -quiet $tb_dir/clk_gena.vhd" >>$run_dir/cmd

      echo "vcom -quiet $tb_dir/add_tasks.vhd" >>$run_dir/cmd

      vcom -quiet $model_dir/pack_disp_conv_dis.vhd

      vcom -quiet $model_dir/test_tasks_pkg_rx.vhd

      vcom -quiet $model_dir/test_tasks_pkg_tx.vhd

      vcom -quiet $model_dir/txerr_ref.vhd

      vcom -quiet $model_dir/lfi_ref.vhd

      vcom -quiet $model_dir/SingleChannel_rx.vhd

      vcom -quiet $model_dir/SingleChannel_tx.vhd

      vcom -quiet $model_dir/SingleChannel.vhd

      vcom -quiet $model_dir/latchs.vhd

      vcom -quiet $model_dir/cyp15g0403dxb.vhd

      vcom -quiet $tb_dir/clk_gena.vhd

      vcom -quiet $tb_dir/add_tasks.vhd



echo "vcom -quiet $tb_dir/$1" >>$run_dir/cmd

vcom -quiet $1

# Choosing the dumping option

if (("$3" == "Y") || ("$3" == "y")) then

echo "vsim -t 1fs -c cyp15g0403dxb_tb_top -do "\""vcd file $rpt_dir/$m.vcd ; vcd add -r *; run -all; quit"\"" | tee  $rpt_dir/$m.log ;" >>$run_dir/cmd

vsim -t 1fs -c cyp15g0403dxb_tb_top -do "vcd file $m.vcd ; vcd add -r *; run -all; quit" | tee  $m.log ;

mv $m.vcd $rpt_dir/

else

echo "vsim -t 1fs -c cyp15g0403dxb_tb_top -do  "\""run -all; quit"\"" | tee  $rpt_dir/$m.log;" >>$run_dir/cmd

vsim -t 1fs -c cyp15g0403dxb_tb_top -do " run -all; quit" | tee  $m.log;

endif

##echo SIMULATION ENDED AT `date`  >>$run_dir/cmd

\rm -rf run_default

mv $run_dir/cmd $run_dir/run_default

chmod 755 $run_dir/run_default

mv $m.log $rpt_dir/

\rm -rf *.log

endif

cd $run_dir

exit



